<?php

namespace App\Http\Requests\Admin;

use App\Http\Requests\ApiRequest;

/**
 * @property int product_category_id
 * @property string title
 * @property int per_page
 * @property string model_number
 */
class ProductionIndexRequest extends ApiRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'product_category_id' => 'sometimes|numeric',
            'model_number'        => 'sometimes|string',
            'title'               => 'sometimes|string',
        ];
    }

    /**
     * @return array
     */
    public function messages()
    {
        return [
            'product_category_id.*' => ':attribute必须是数字',
            'model_number.*'        => ':attribute必须是字符串',
            'title.*'               => ':attribute必须是字符串',
        ];
    }

    /**
     * @return array
     */
    public function attributes()
    {
        return [
            'product_category_id' => '商品的类别',
            'model_number'        => '商品的型号',
            'title'               => '商品的标题',
        ];
    }
}
